import { FC, useMemo } from 'react';
import { RouteComponentProps } from 'react-router'
import _ from 'lodash';
import { WithNormalRender } from "@ey-render/hoc-form";
import api from './services';
import { onFieldInit } from '@formily/core';
import {useParams} from "react-router-dom";
import components from "@/components/schema-form-render/schema-components-registed/components-biz";

interface FileBoxDetailProps extends RouteComponentProps {}

const FileBoxDetail: FC<FileBoxDetailProps> = ({

}) => {
    const { id, boxCode } = useParams();

  const detailApi: any = useMemo(() => {
    return {
        remoteUrl: api.detail,
        method: 'POST',
        remoteParams: {
          id,
          code: boxCode
        },
        pageCode: 'ArcvFileBox_D',
    };
  }, [id]);

  const BillFormLayout = useMemo(() => {
    return WithNormalRender({
        filedConfig: {},
        components: {
            ...components,
        },
    });
  }, []);

  return (
    <BillFormLayout
      anchor
      type="DETAIL"
      {...detailApi}
      formConfigs={{
        effects: () => {
          onFieldInit('arcvItems.operations', field => {
            field.visible = false;
          })
        }
      }}
      filedConfig={{}}
    />
  );
};

export default FileBoxDetail;
